//
// Created by liaojili on 2023/11/8.
//
//
// Created by liaojili on 2023/11/6.
//
#include <stdio.h>

void main() {
    double balance = 0;
    double addMoney, minusMoney;
    int flag = 1;
    int selection;
    do {
        printf("1.deposit\n");
        printf("2.withdrawal\n");
        printf("3.Show balance\n");
        printf("4.exit\n");
        scanf("%ld", &selection);
        switch (selection) {
            case 1:
                scanf("%lf", &addMoney);
                if (addMoney > 0) {
                    balance += addMoney;
                } else {
                    printf("The amount you entered is incorrect\n");
                }
                break;
            case 2:
                scanf("%lf", &minusMoney);
                if (minusMoney > 0 && minusMoney < balance) {
                    balance -= minusMoney;
                } else {
                    printf("The amount you entered is incorrect or the balance is insufficient\n");
                }
                break;
            case 3:
                printf("Your balance is %.2lf\n", balance);
                break;
            case 4:
                flag = 0;
                printf("welcome to come again\n");
                break;
            default:
                printf("You entered the error, please re-enter\n");
                break;
        }
    } while (flag);
}